package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.WPriceTemplateEntity;
import com.lx.oms.controller.manager.WPriceTemplateManager;
import com.lx.oms.controller.service.WPriceTemplateService;

/**
 * 参考价格
 *
 * @author houzhong
 * @date 2018年8月16日 上午11:58:55
 */
@Service("wPriceTemplateService")
public class WPriceTemplateServiceImpl implements WPriceTemplateService {

	@Autowired
	private WPriceTemplateManager wPriceTemplateManager;

	@Override
	public Page<WPriceTemplateEntity> listWPriceTemplate(Map<String, Object> params) {
		Query query = new Query(params);
		Page<WPriceTemplateEntity> page = new Page<>(query);
		wPriceTemplateManager.listWPriceTemplate(page, query);
		return page;
	}

	@Override
	public R saveWPriceTemplate(WPriceTemplateEntity role) {
		int count = wPriceTemplateManager.saveWPriceTemplate(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getWPriceTemplateById(BigInteger id) {
		WPriceTemplateEntity wPriceTemplate = wPriceTemplateManager.getWPriceTemplateById(id);
		return CommonUtils.msg(wPriceTemplate);
	}

	@Override
	public R updateWPriceTemplate(WPriceTemplateEntity wPriceTemplate) {
		int count = wPriceTemplateManager.updateWPriceTemplate(wPriceTemplate);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = wPriceTemplateManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
